package com.yesep.learn.netty.tcp.protocol.common;


/**
 * @Description: 命令编码
   *   共有四类命令（即请求命令、上传命令、通知命令和交互命令），命令编码分为以下四组： 
 * 1000~1999 表示初始化命令和参数命令编码； 
 * 2000~2999 表示数据命令编码； 
 * 3000~3999 表示控制命令编码； 
 * 9000~9999 表示交互命令编码
 */
public enum CN_OPT {
	_9015("9015","心跳包命令",CN_TYPE.PARAMETER, CN_TARGET.UP,"用于判断网络连接在线状态"),
	_1000("1000","设置超时时间及重发次数",CN_TYPE.PARAMETER, CN_TARGET.DOWN,"用于上位机设置现场机的超时时间及重发次数，超时时间及重发次数参考取值参见示例《表1》"),
	_1011("1011","提取监测仪表时间",CN_TYPE.PARAMETER, CN_TARGET.BOTH,"用于提取或者上传监测仪表的系统时间"),
	_1012("1012","设置监测仪表时间",CN_TYPE.PARAMETER, CN_TARGET.DOWN,"用于设置监测仪表的系统时间"),
	_1014("1014","提取数采仪时间",CN_TYPE.PARAMETER, CN_TARGET.BOTH,"用于提取或者上传数采仪的系统时间"),
	_1015("1015","设置数采仪时间",CN_TYPE.PARAMETER, CN_TARGET.DOWN,"用于设置数采仪的系统时间"),
	_1061("1061","提取实时数据间隔",CN_TYPE.PARAMETER, CN_TARGET.BOTH,"提取实或者上传时数据间隔"),
	_1062("1062","设置实时数据间隔",CN_TYPE.PARAMETER, CN_TARGET.DOWN,"指定实时数据间隔"),
	_1072("1072","设置数采仪密码",CN_TYPE.PARAMETER, CN_TARGET.DOWN,"用于设置数采仪基站软件的密码"),
	_2011("2011","取监测指标实时数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于启动数采仪上传实时数据"),
	_2061("2061","上传测量数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪地表水小时历史数据"),
	_2062("2062","上传核查数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪质控核查数据"),
	_2063("2063","上传加标回收数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪质控加标回收测试数据"),
	_2064("2064","上传平行样测试数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪质控平行样测试数据"),
	_2065("2065","上传零点核查数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪质控零点核查数据"),
	_2066("2066","上传跨度核查数据",CN_TYPE.DATA, CN_TARGET.BOTH,"用于上传数采仪质控跨度核查数据"),
	_2081("2081","上传数采仪开机时间",CN_TYPE.DATA, CN_TARGET.UP,"用于数采仪自动上报数采仪开机时间"),
	_3015("3015","手动远程留样",CN_TYPE.CONTROL, CN_TARGET.DOWN,"用于上位机启动即时留样"),
	_3020("3020","上传仪表信息（日志、状态、参数）",CN_TYPE.CONTROL, CN_TARGET.BOTH,""),
	_3021("3021","设置仪表信息（参数）",CN_TYPE.CONTROL, CN_TARGET.BOTH,""),
	_3040("3040","提取现场系统信息",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3041("3041","提取现场经纬度及环境信息",CN_TYPE.CONTROL, CN_TARGET.BOTH,"（根据集成商扩展）"),
	_3042("3042","远程切换运行模式",CN_TYPE.CONTROL, CN_TARGET.DOWN,"0：维护模式；1：常规（间歇）模式；2：应急（连续）模式；3：质控模式；"),
	_3043("3043","远程重启现场数采仪",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3044("3044","远程启动系统单次测试",CN_TYPE.CONTROL, CN_TARGET.DOWN,"用于上位机启动即时采样测试"),
	_3045("3045","远程控制系统紧急停机命令",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3046("3046","远程控制系统进入待机命令",CN_TYPE.CONTROL, CN_TARGET.DOWN,"用于上位机启动现场机/分析仪设备进入待机状态"),
	_3047("3047","系统报警确认",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3048("3048","远程启动系统全面清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3049("3049","远程启动系统外管路清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3050("3050","远程启动系统内管路清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3051("3051","远程启动沉砂池清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3052("3052","远程启动系统除藻操作",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3053("3053","远程启动五参数池清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3054("3054","远程启动系统过滤器清洗",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3055("3055","远程设置系统沉淀时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3056("3056","远程设置系统运行测量时间间隔",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3057("3057","设置采样泵运行模式",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3058("3058","远程控制泵",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3059("3059","远程控制阀门",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（根据集成商扩展）"),
	_3060("3060","设置采样时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"设置源水泵从河口取水采样时长（单位为秒），根据集成商扩展"),
	_3061("3061","设置进样时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"从设置沉淀池向采样杯打水时长（单位为秒），根据集成商扩展"),
	_3062("3062","设置清洗外管路时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（单位为秒），根据集成商扩展"),
	_3063("3063","设置清洗内管路时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（单位为秒），根据集成商扩展"),
	_3064("3064","设置清洗清预处理单元时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"指清洗沉淀池和五参数池时长（单位为秒），根据集成商扩展"),
	_3065("3065","设置测量分析时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"（单位为秒），根据集成商扩展"),
	_3066("3066","设置补水时间",CN_TYPE.CONTROL, CN_TARGET.DOWN,"一次进样太短允许二次补水进样（单位为秒），根据集成商扩展"),
	_3080("3080","启动单台仪表标液核查",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3081("3081","启动单台仪表加标回收",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3082("3082","启动单台仪表平行样测试",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3083("3083","启动单台仪表零点核查",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3084("3084","启动单台仪表跨度核查",CN_TYPE.CONTROL, CN_TARGET.DOWN,""),
	_3085("3085","启动空白校准",CN_TYPE.CONTROL, CN_TARGET.DOWN,"仪器采用蒸馏水测试结果对仪器进行校准的过程"),
	_3086("3086","启动标样校准",CN_TYPE.CONTROL, CN_TARGET.DOWN,"仪器采用标准溶液测试结果对仪器校准系数或工作曲线方程进行校准的过程"),
	_9011("9011","请求应答",CN_TYPE.INTERACTIVE, CN_TARGET.UP,"用于数采仪回应接收上位机请求命令是否有效"),
	_9012("9012","执行结果",CN_TYPE.INTERACTIVE, CN_TARGET.UP,"用于数采仪回应接收上位机请求命令执行结果"),
	_9013("9013","通知应答",CN_TYPE.INTERACTIVE, CN_TARGET.BOTH,"回应通知命令"),
	_9014("9014","数据应答",CN_TYPE.INTERACTIVE, CN_TARGET.BOTH,"数据应答命令"),
	_9016("9016","系统应答",CN_TYPE.INTERACTIVE, CN_TARGET.BOTH,"数据应答命令");

	private String code;//命令编码
	private String name;//命令名称
	private CN_TYPE type;//命令类别
	private CN_TARGET target;//命令方向
	private String remark;//备注

	private CN_OPT(String code, String name, CN_TYPE type, CN_TARGET target, String remark) {
		this.code = code;
		this.name = name;
		this.type = type;
		this.target = target;
		this.remark = remark;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public CN_TYPE getType() {
		return type;
	}

	public CN_TARGET getTarget() {
		return target;
	}

	public String getRemark() {
		return remark;
	}

	@Override
	public String toString() {
		return this.name() + "(" + this.code + " | " + this.name + " | " + this.remark + ")";
	}

	public static CN_OPT get(String code) {
		for (CN_OPT e : CN_OPT.values()) {
			if (e.getCode().equals(code)) {
				return e;
			}
		}
		return null;
	}
}
